package com.chenfan.ccp.plug.log.handler;

import ch.qos.logback.core.rolling.TimeBasedRollingPolicy;
import com.chenfan.ccp.util.start.ApplicationContextUtil;

public class CustomTimeBasedRollingPolicy extends TimeBasedRollingPolicy {

    @Override
    public void setFileNamePattern(String zipFileName) {

        if (ApplicationContextUtil.isProd()) {
            zipFileName = zipFileName.substring(0, zipFileName.lastIndexOf("_.zip")) + CustomRollingFileAppender.LOG_SUFFIX + ".zip";
        }

        super.setFileNamePattern(zipFileName);

    }


}
